package com.ruoyi.report.controller.report;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.report.domain.HanZaiBuyHouse;
import com.ruoyi.report.domain.HanZaiCheckOutTheDetail;
import com.ruoyi.report.domain.HanZaiHouseInfo;
import com.ruoyi.report.service.HanZaiCheckOutTheDetailService;
import com.ruoyi.report.service.HanZaiHouseInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: 憨憨爱崽崽
 * Name: HanZaiCheckOutTheDetailController 退房明细
 * Date: 2022/5/7
 * Time: 1:41
 **/
@RestController
@RequestMapping("/chenk_out_the_detail")
public class HanZaiCheckOutTheDetailController extends BaseController {
    @Autowired
    private HanZaiCheckOutTheDetailService checkOutTheDetailService;
    @Autowired
    private HanZaiHouseInfoService houseInfoService;
    @RequestMapping("/detail/list")
    public TableDataInfo getDetailList(HanZaiBuyHouse buyHouse){
        startPage();
        List<HanZaiCheckOutTheDetail> hanZaiCheckOutTheDetails = checkOutTheDetailService.queryCheckOutTheDetailList(buyHouse);
        for (HanZaiCheckOutTheDetail detail : hanZaiCheckOutTheDetails){
            System.out.println(detail);
        }
        return getDataTable(hanZaiCheckOutTheDetails);
    }
    @RequestMapping("/changeRooms/list")
    public TableDataInfo getChangeRoomsList(HanZaiBuyHouse buyHouse){
        startPage();
        List<HanZaiCheckOutTheDetail> hanZaiCheckOutTheDetails = checkOutTheDetailService.queryChangeRoomsList(buyHouse);
        for (HanZaiCheckOutTheDetail detail : hanZaiCheckOutTheDetails){
            HanZaiHouseInfo houseInfoTow = houseInfoService.selectHouseInfoByHouseId(Long.valueOf(detail.getHourseid2()));
            detail.setHousename2(houseInfoTow.getHouseName());
            System.out.println(detail);
        }
        return getDataTable(hanZaiCheckOutTheDetails);
    }

}
